<template>
	<view >
		<view class="nav">
			<uni-nav-bar left-icon="left" title="公告详情" @clickLeft='goNotice'></uni-nav-bar>
		</view>
		<view class="content" v-for="v in showData" :key='v.notice_id'>
			<view class="title">
				<h3>{{v.notice_title}}</h3>
			</view>
			<view class="section">
				<p>{{'发布人：'+v.notice_author}}</p>
			</view>
			<view class="time">
				<p>{{'发布时间：'+v.notice_time}}</p>
			</view>
			<view class="details">
				<p>{{v.tag}}</p>
				<p>{{v.digest}}</p>
				<p>{{v.notice_content}}
				</p>
				
			</view>
			
		
		</view>
	</view>
</template>

<script>
	import { reactive, toRefs,onMounted,onBeforeMount,computed,onBeforeUpdate } from 'vue';
	import { useStore, mapState} from 'vuex';
	export default {
		
		setup(){
			const store = useStore();
			let data=reactive({
				id:0,
				showData:computed(() =>store.state.dongji.showData),
				show: () => store.commit('dongji/show'),
				goNotice:()=>{
					uni.navigateTo({
						url:'../announcement_notice/announcement_notice'
					})
				}
		});
		onMounted(()=>{
			data.show();
		}); 
		return {...toRefs(data)}
		},
		onLoad:function (option) {
		// #ifdef APP-NVUE
		  const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE
		  // #endif
		  // #ifndef APP-NVUE
		  const eventChannel = this.getOpenerEventChannel();
		  // #endif
		  eventChannel.emit('acceptDataFromOpenedPage', {data: 'data from test page'});
		  eventChannel.emit('someEvent', {data: 'data from test page for someEvent'});
		  // 监听acceptDataFromOpenerPage事件，获取上一页面通过eventChannel传送到当前页面的数据
		  eventChannel.on('acceptDataFromOpenerPage', function(data) {
		    // console.log(data)
			data.id=data.id
			// console.log(data.id);
		  })
		}
	}
</script>

<style lang="scss">
.nav{
	.uniui-left{
		color:#2D8CF0 !important;
	}
}
.content{
	background-color: #F2F2F2;
	line-height: 48rpx;
	.title{
		font-size: 28rpx;
		background-color: white;
		padding: 0 24rpx;
	}
	.section{
		font-size: 28rpx;
		color: #929292;
		background-color: white;
		padding: 0 24rpx;
		
	}
	.time{
		font-size: 24rpx;
		color: #929292;
		background-color: white;
		padding: 0 24rpx;
		margin-bottom: 24rpx;
		
	}
	.details{
		font-size: 28rpx;
		color: #666666;
		background-color: white;padding: 0 24rpx;
		
	}
}
</style>
